package li.webqq.api;

import li.http.Request;
import li.webqq.Const;
import li.webqq.util.StringUtil;

/**
 * @see li.webqq.api.ApiTest#login()
 * @see li.webqq.core.WebQq#login1(String)
 */
public class LoginRequest extends Request implements Const {
    private String u;
    private String password;
    private String uin16;
    private String verifycode;

    public void setU(String u) {
        this.u = u;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public void setUin16(String uin16) {
        this.uin16 = uin16;
    }

    public void setVerifycode(String verifycode) {
        this.verifycode = verifycode;
    }

    public LoginResponse execute() {
        super.setUrl(URL_LOGIN);
        super.setReferer(URL_LOGIN_UI);

        super.setParameter("u", u);
        super.setParameter("p", StringUtil.encodePassword(uin16, password, verifycode));
        super.setParameter("verifycode", this.verifycode);

        return super.execute(new LoginResponse());
    }
}